<!doctype html>
<html>
<head>
<meta charset="utf-8">
    <title>佣金</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport">     
    <meta content="yes" name="apple-mobile-web-app-capable">     
    <meta content="black" name="apple-mobile-web-app-status-bar-style">     
    <meta content="telephone=no" name="format-detection">
    <link rel="shortcut icon" href="/favicon.ico">
    <link rel="stylesheet" type="text/css" href="/H5/css/sm.min.css" />
    <link rel="stylesheet" type="text/css" href="/H5/css/reset.css" />
    <link rel="stylesheet" type="text/css" href="/H5/css/commission.css?v=2" />
</head>            
<body>
	<div class="page-group ms-controller" :controller="commission">
        <div class="page page-current">
            <header class="bar bar-nav">
              	<a class="icon icon-left pull-left" href="javascript:window.history.go(-1);"></a>
              	<a class="icon icon-home pull-right" href="/H5"></a>
              	<h1 class="title">{{@type==1?'结缘豆':@type==2?'服务佣金':@type==12?'红豆':'一星红豆'}}</h1>
            </header>
            <div class="content visibility infinite-scroll infinite-scroll-bottom" data-distance="100" style="padding-top: 80px;">
    			<div class="integral_balance" style="position: fixed; width: 100%; top: 2.5rem">
                	<div>{{@type==1?'结缘豆':@type==2?'服务佣金总收益':@type==12?'红豆':'一星红豆'}}</div>
                    <div style="font-size:28px;">{{@data.total_commission||0}}</div>
                </div>
                <div class="table">
                    <a class="img_right" :for="el in @list" :attr="{'href': '/H5/commissiondetail?type='+@type+'&uid='+el.uid+'&status=1'}">
                        <img :attr="{'src': el.avatar_url}" />
                        <div class="tel_left">
                            <span style="float: left">{{el.mobile||""}}</span>
                            <span style="color:#0c0;float: right;font-size: 1rem">+{{el.total_commission||0}}</span>
                        </div>
                        <div class="tel_right">
                            <span style="color:black;font-weight: normal; float: left;font-size: .8rem;">{{el.real_name}}</span>
                            <span style="color:#0c0; font-weight: normal; float: right;font-size: .7rem; padding-right: 6%">总消费:￥{{el.total_buy||0}} 总贡献:{{el.total_contribution||0}}</span>
                        </div>
                    </a>
                </div>
                <div :if="@more" class="infinite-scroll-preloader">
                    <div class="preloader"></div>
                </div>
			</div>
        </div>
    </div>
<script type='text/javascript' src='/H5/js/zepto.min.js' charset='utf-8'></script>
<script type='text/javascript' src='/H5/js/sm.min.js' charset='utf-8'></script>
<script type='text/javascript' src='/H5/js/avalon.js' charset='utf-8'></script>
<script type='text/javascript' src='/H5/js/simpleStorage.js' charset='utf-8'></script>
<script type='text/javascript' src='/H5/js/mall.js?v=10' charset='utf-8'></script>
<script>
	var commission = avalon.define({
		$id: "commission",
		list: [],
        type: Mall.parseUrl( window.location.href ).type,
        data: {},
        loading: false,
        more: false,
        page_num: 1,
        page_size: 10,
		getCommission: function( t ){
            if( commission.loading ){
                return
            }
            commission.loading = true;
			Mall.request( "/api/CommissionSaleList", {page_num: commission.page_num, page_size: commission.page_size, level: commission.type} )
				.always( function( data ){
                    if( data.error_code == 0 ){
                        commission.data = data.data;
                        commission.list = commission.list.concat( data.data.list );
                        if( commission.page_num == data.data.page_total ){
                            commission.more = false;
                        }
                        else{
                            if( data.data.list.length == 0 ){
                                commission.more = false;
                            }
                            else{
                                commission.more = true;
                            }
                        }
                        commission.page_num ++;
                    }
                    commission.loading = false;
				} )
			$( ".content" ).removeClass( "visibility" )
		},
        infinite: function(){
            $(document).on('infinite', '.infinite-scroll-bottom',function() {
                if( commission.more ){
                    commission.getCommission();
                }
            });
            $.init();
        }
	})
    commission.getCommission();
	commission.infinite();
	avalon.scan( document.body )
</script>
</body>
</html>